#ifndef VL_FLAGS_HPP
#define VL_FLAGS_HPP

namespace vl
{

struct flags
{
	flags(unsigned int f)
	: flags_(f)
	{
	}

	void change_flags(unsigned int f, unsigned int mask)
	{
		flags_ = (flags_ & ~mask) | (f & mask);
	}
	
	void set_flags(unsigned int f)
	{
		flags_ |= f;
	}
	
	void reset_flag(unsigned int f)
	{
		flags_ &= ~f;
	}

	void replace_flags(unsigned int f)
	{
		flags_ = f;
	}
	
	bool any_flag(unsigned int f)
	{
		return (flags_ & f) != 0;
	}
	
	bool all_flags(unsigned int f)
	{
		return (flags_ & f) == f;
	}
	
	bool no_flags(unsigned int f)
	{
		return (flags_ & f) == 0;
	}
	
	void toggle_flags(unsigned int f)
	{
		flags_ ^= f;
	}
	
	unsigned int as_int()
	{
		return flags_;
	}
	
private:
	unsigned int flags_;
};

}

#endif // VL_FLAGS_HPP
